class Solution {
    public int findNthDigit(int n) {
         int digit = 1; //位数
        long start = 1;
        long count = 9; //总数字个数
        while (n > count) { 
            n -= count;
            digit += 1;
            start *= 10;
            count = digit * start * 9;
        }
        long num = start + (n - 1) / digit;//向下取整（23,24-->11）
        return Long.toString(num).charAt((n - 1) % digit) - '0';
    }
}